<template>
  <div class="LeftOne">
    <div class="per" v-for="(per, index) in leftonedata" :key="index">
      <div class="title">{{ per.title }}</div>
      <div class="numbers bg">
        <span class="num bottom">{{ per.num }}</span>
        <span class="unit">{{ per.unit }}</span>
      </div>
      <div class="numbers loc">
        <span class="num">{{ per.num }}</span>
        <span class="unit">{{ per.unit }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import { getLeftOne } from "../assets/api/api";
export default {
  data() {
    return {
      leftonedata: [],
      timer: null,
    };
  },
  created() {
    this.fetchData();
    this.timer = setInterval(() => {
      this.fetchData();
    }, this.schedule);
  },
  destroyed() {
    clearInterval(this.timer);
  },
  methods: {
    fetchData() {
      getLeftOne().then((res) => {
        this.leftonedata = res.data.result;
      });
    },
  },
};
</script>

<style lang="less" scoped>
.LeftOne {
  display: flex;
  margin-left: 12.5px;
  .per {
    text-align: center;
    margin: 0 33.5px;
    .title {
      margin-top: 50px;
      margin-bottom: 17px;
      font-family: SourceHanSansCN-Medium;
      font-size: 26px;
      color: white;
    }
    .loc {
      margin-top: -185px;
    }
    .bg {
      background-image: url("../assets/v6_悬浮.gif");
    }
    .numbers {
      background-position-y: 41px;
      background-repeat: no-repeat;
      width: 164px;
      height: 185px;
      .bottom {
        text-shadow: 2px 2px 6.8px rgb(255, 194, 95);
      }
      .num {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 50px;
        font-weight: 600;
        background-image: -webkit-linear-gradient(bottom, #fff000, #ffb800);
        background-clip: text;
        -webkit-text-fill-color: transparent;
      }
      .unit {
        margin-left: 8px;
        // float: left;
        margin-top: 24px;
        font-family: SourceHanSansCN-Medium;
        font-size: 20px;
        color: white;
      }
    }
  }
}
</style>
